package m.jclecai.com.dialog;

import android.content.Context;
import android.text.TextUtils;
import android.widget.EditText;

import butterknife.BindView;
import butterknife.OnClick;
import m.jclecai.com.R;
import m.jclecai.com.listener.Callback;
import m.jclecai.com.utils.MyToast;

/**
 * Created by ZD on 2017/6/28.
 */

public class ConvertRedDialog extends BaseDialog {

    @BindView(R.id.et_code)
    EditText etCode;
    @BindView(R.id.et_pwd)
    EditText etPwd;

    public ConvertRedDialog(Context context) {
        super(context);
        initView();
    }

    public ConvertRedDialog(Context context, boolean fromButton) {
        super(context, fromButton);
        initView();
    }

    public void initView() {
        super.setContentView(R.layout.dialog_red);
    }

    Callback callback;

    public void setCallback(Callback callback) {
        this.callback = callback;
    }

    @OnClick(R.id.tv_convert)
    void convert() {
        if(TextUtils.isEmpty(etCode.getText().toString())){
            MyToast.showToast(getContext(),"请输入卡号");
            return;
        }
        if(TextUtils.isEmpty(etPwd.getText().toString())){
            MyToast.showToast(getContext(),"请输入卡密");
            return;
        }
        if (callback != null)
            callback.onClick(new String[]{etCode.getText().toString(),etPwd.getText().toString()});
    }
}
